package com.zbs.framework.dao.function.service.model;

import com.zbs.framework.dao.function.entity.Function;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.List;
import java.util.Set;

/**
 * 功能节点
 */
@Getter
@Setter
@NoArgsConstructor
public class FunctionNode {

    private Long id;
    /**
     * 标识符
     */
    private String identifier;
    /**
     * 功能名
     */
    private String name;
    /**
     * 描述
     */
    private String description;
    /**
     * 父节点ID
     */
    private Long parentId;
    /**
     * 等级
     */
    private Integer level;
    /**
     * 关联权限
     */
    private Set<PermissionBasic> permInfos;
    /**
     * 权限
     */
    private List<FunctionNode> children;

    public FunctionNode(Function function, Set<PermissionBasic> permInfos, List<FunctionNode> children) {
        this.id = function.getId();
        this.identifier = function.getIdentifier();
        this.name = function.getName();
        this.description = function.getDescription();
        this.parentId = function.getParentId();
        this.level = function.getLevel();
        this.permInfos = permInfos;
        this.children = children;
    }

}
